Skip to content

feat: hide viewed stories by dwell time - #136

Merged
therealsama merged 1 commit into
mainfrom
feat/dwell-based-viewed-story-hiding
Jun 7, 2026
Merged

therealsama merged 1 commit into
mainfrom
feat/dwell-based-viewed-story-hiding

Conversation

@therealsama

Copy link
Copy Markdown
Collaborator

Track viewed items with an absolute expiresAt model and dwell-based TTL tiers (12h for <3s, 24h for 3-60s, 48h for >60s; 5 days on title click). Add a useViewDwell hook that measures visible dwell and extends (never shortens) the hide window; re-views skip the write when they wouldn't extend it. Also wrap touch event dispatches in act() to clear useSwipeScroll test warnings.

Consolidate the parallel title/detail time stores behind a single createTimeMap factory, and make its load() tolerant of a corrupt/foreign value at the key: only a plain object with finite-number values is a valid id->expiresAt map (a non-number would poison the Math.max merge with NaN and wedge the entry). Strengthen the mobile swipe filter e2e to assert the hidden story is actually gone rather than merely that a panel renders.

Guard the e2e swipe helper against a transient 0-width container read that made the offline end-of-feed test crash with "Invalid array length" on Firefox, and pass waitForSwipeReady's timeout in the options arg so its intended 5s limit is actually applied.

Backfill the highest-value test gaps: the useViewDwell re-key path (swipe A->B finalizes A's tier and floors B) and its pagehide finalize; SwipeStoryViewerCore mount-snapshot filtering (session-exempt keep + all-filtered fallback); and the load() guard's array-discard and non-number-value branches.

Track viewed items with an absolute expiresAt model and dwell-based TTL
tiers (12h for <3s, 24h for 3-60s, 48h for >60s; 5 days on title click).
Add a useViewDwell hook that measures visible dwell and extends (never
shortens) the hide window; re-views skip the write when they wouldn't
extend it. Also wrap touch event dispatches in act() to clear
useSwipeScroll test warnings.

Consolidate the parallel title/detail time stores behind a single
createTimeMap factory, and make its load() tolerant of a corrupt/foreign
value at the key: only a plain object with finite-number values is a valid
id->expiresAt map (a non-number would poison the Math.max merge with NaN
and wedge the entry). Strengthen the mobile swipe filter e2e to assert the
hidden story is actually gone rather than merely that a panel renders.

Guard the e2e swipe helper against a transient 0-width container read
that made the offline end-of-feed test crash with "Invalid array length"
on Firefox, and pass waitForSwipeReady's timeout in the options arg so
its intended 5s limit is actually applied.

Backfill the highest-value test gaps: the useViewDwell re-key path (swipe
A->B finalizes A's tier and floors B) and its pagehide finalize;
SwipeStoryViewerCore mount-snapshot filtering (session-exempt keep +
all-filtered fallback); and the load() guard's array-discard and
non-number-value branches.
@therealsama
therealsama requested a review from kplachkov as a code owner June 7, 2026 21:49
@therealsama
therealsama enabled auto-merge June 7, 2026 21:56
@therealsama
therealsama merged commit 5ceaff1 into main Jun 7, 2026
4 checks passed
@therealsama
therealsama deleted the feat/dwell-based-viewed-story-hiding branch June 7, 2026 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants